package com.wc.codeforces.DP.线性DP.Boring_Day;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/6/25 23:23
 * @description https://codeforces.com/contest/1982/problem/C
 */
public class Main {
    /**
     * 思路：
     * DP思想, f[i]表示从1 ~ i的卡牌中能满足要求的最多对, 那是不是我们可以从前面找一个满足要求的最右边的
     * 满足要求是需要用到前缀和的,那就可以用二分来查找，满足要求的
     * 答案就呼之欲出了
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010, M = N << 2;
    static int[] a = new int[N];
    static long[] sum = new long[N];
    static int[] f = new int[N];
    static int n, L, R;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            L = sc.nextInt();
            R = sc.nextInt();
            for (int i = 1; i <= n; i++) {
                a[i] = sc.nextInt();
                sum[i] = sum[i - 1] + a[i];
            }
            for (int i = 1; i <= n; i++) {
                if (sum[i] < L) f[i] = f[i - 1];
                else {
                    int l = 0, r = i - 1;
                    while (l < r) {
                        int mid = l + r + 1 >> 1;
                        if (sum[i] - sum[mid] >= L) l = mid;
                        else r = mid - 1;
                    }
                    if (sum[i] - sum[l] > R) f[i] = f[i - 1];
                    else f[i] = Math.max(f[l] + 1, f[i - 1]);
                }
            }
            out.println(f[n]);
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
